package com.itheima.exception;

import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Description:
 * @Version: V1.0
 */
@Component
@ControllerAdvice
public class ProjectExceptionAdvice {
    @ExceptionHandler(BusinessException.class)
    public String doBusinessException(Exception e, Model m){
        m.addAttribute("msg",e.getMessage());
        return "error.jsp";
    }
    @ExceptionHandler(SystemException.class)
    public String doSystemException(Exception e, Model m){
        m.addAttribute("msg",e.getMessage());
        return "error.jsp";
    }
}
